﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Ricerca candidato
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">

        function search() {
            $("#searchPanel").hide();
            var lastname = $("#Lastname").val();
            $.getJSON("odata/Models()?$filter=substringof('" + encodeURIComponent(lastname) + "',LastName)", null, function (data) {
                var grid = $("#searchResults .grid");
                $("tr[class='td']", grid).remove();

                jQuery.each(data.d, function (i, m) {
                    var row = $("<tr class='td'/>");
                    grid.append(row);

                    addCell(row, m.FirstName);
                    addCell(row, m.FirstName);
                    addCell(row, m.LastName);
                    addCell(row, "F");
                    addCell(row, "10/01/1988");
                    addCell(row, m.ResidenceCity);
                });

                $("#searchResults").show();
            });

            return false;
        }

        function newSearch() {
            $("#searchPanel").show();
            $("#searchResults").hide();
        }

        function addCell(row, text) {
            var cell = $("<td />");
            cell.text(text)
            row.append(cell);
        }

    </script>
    <div id="searchPanel">
        <h2>
            Ricerca modella</h2>
        <form onsubmit="return search()" method="post">
        <div class="editor-label">
            <label for="Nickname">
                Nickname</label></div>
        <div class="editor-field">
            <input class="text-box single-line" id="Nickname" name="Nickname" type="text" value="" />
        </div>
        <div class="clear">
        </div>
        <div class="editor-label">
            <label for="Firstname">
                Nome</label></div>
        <div class="editor-field">
            <input class="text-box single-line" id="Firstname" name="Firstname" type="text" value="" />
        </div>
        <div class="clear">
        </div>
        <div class="editor-label">
            <label for="Lastname">
                Cognome</label></div>
        <div class="editor-field">
            <input class="text-box single-line" id="Lastname" name="Lastname" type="text" value="" />
        </div>
        <div class="clear">
        </div>
        <div class="editor-label">
            <label for="MinBirthDate">
                Da data nascita</label></div>
        <div class="editor-field">
            <input class="dateInput" id="MinBirthDate" name="MinBirthDate" type="text" value="" />
        </div>
        <div class="clear">
        </div>
        <div class="editor-label">
            <label for="MaxBirthDate">
                A data nascita</label></div>
        <div class="editor-field">
            <input class="dateInput" id="MaxBirthDate" name="MaxBirthDate" type="text" value="" />
        </div>
        <div class="clear">
        </div>
        <div class="editor-label">
            <label for="CurrentCountry">
                Residenza attuale</label></div>
        <div class="editor-field">
            <select id="CurrentCountry_CountryID" name="CurrentCountry.CountryID">
                <option value="">Seleziona una nazione...</option>
                <option value="1">Afghanistan</option>
                <option value="2">Albania</option>
                <option value="3">Algeria</option>
                <option value="4">American Samoa</option>
                <option value="5">Andorra</option>
                <option value="6">Angola</option>
                <option value="7">Anguila</option>
                <option value="8">Antarctica</option>
                <option value="9">Antigua</option>
                <option value="10">Argentina</option>
                <option value="11">Armenia</option>
                <option value="12">Aruba</option>
                <option value="13">Australia</option>
                <option value="14">Austria</option>
                <option value="15">Azerbaijan</option>
                <option value="16">Bahamas</option>
                <option value="17">Bahrain</option>
                <option value="18">Bangladesh</option>
                <option value="19">Barbados</option>
                <option value="20">Belarus</option>
                <option value="21">Belgium</option>
                <option value="22">Belize</option>
                <option value="23">Benin</option>
                <option value="24">Bermuda</option>
                <option value="25">Bhutan</option>
                <option value="26">Bolivia</option>
                <option value="27">Bosnia &amp; Herzegovina</option>
                <option value="28">Botswana</option>
                <option value="29">Brazil</option>
                <option value="30">Bristish Indian Ocean Territory</option>
                <option value="31">Brunei</option>
                <option value="32">Bulgaria</option>
                <option value="33">Burkino Faso</option>
                <option value="34">Burundi</option>
                <option value="35">Cambodia</option>
                <option value="36">Cameroon</option>
                <option value="37">Canada</option>
                <option value="38">Cape Verde</option>
                <option value="39">Cayman Islands</option>
                <option value="40">Central African Republic</option>
                <option value="41">Chad</option>
                <option value="42">Chile</option>
                <option value="43">China</option>
                <option value="44">Christmas Island</option>
                <option value="45">Colombia</option>
                <option value="46">Comoros</option>
                <option value="47">Congo</option>
                <option value="48">Congo</option>
                <option value="49">Cook Islands</option>
                <option value="50">Costa Rica</option>
                <option value="51">Cote D&#39;Ivoire</option>
                <option value="52">Croatia</option>
                <option value="53">Cuba</option>
                <option value="54">Cyprus</option>
                <option value="55">Czech Republic</option>
                <option value="56">Denmark</option>
                <option value="57">Djibouti</option>
                <option value="58">Domincan Republic</option>
                <option value="59">Dominica</option>
                <option value="60">East Timor</option>
                <option value="61">Ecuador</option>
                <option value="62">Egypt</option>
                <option value="63">El Salvador</option>
                <option value="64">Equatorial Guinea</option>
                <option value="65">Eritrea</option>
                <option value="66">Estonia</option>
                <option value="67">Ethiopia</option>
                <option value="68">Faeroe Islands</option>
                <option value="69">Falkland Islands</option>
                <option value="70">Fiji</option>
                <option value="71">Finland</option>
                <option value="72">France</option>
                <option value="73">French Guiana</option>
                <option value="74">French Polynesia</option>
                <option value="75">French Southern Territories</option>
                <option value="76">Gabon</option>
                <option value="77">Gambia</option>
                <option value="78">Georgia</option>
                <option value="79">Germany</option>
                <option value="80">Ghana</option>
                <option value="81">Gibraltar</option>
                <option value="82">Greece</option>
                <option value="83">Greenland</option>
                <option value="84">Grenada</option>
                <option value="85">Guadeloupe</option>
                <option value="86">Guam</option>
                <option value="87">Guatemala</option>
                <option value="88">Guinea</option>
                <option value="89">Guinea-Bissau</option>
                <option value="90">Guyana</option>
                <option value="91">Haiti</option>
                <option value="92">Heard Island and McDonald Islands</option>
                <option value="93">Honduras</option>
                <option value="94">Hong Kong</option>
                <option value="95">Hungary</option>
                <option value="96">Iceland</option>
                <option value="97">India</option>
                <option value="98">Indonesia</option>
                <option value="99">Iran</option>
                <option value="100">Iraq</option>
                <option value="101">Ireland</option>
                <option value="102">Israel</option>
                <option value="103">Italy</option>
                <option value="104">Jamaica</option>
                <option value="105">Japan</option>
                <option value="106">Jersey</option>
                <option value="107">Jordan</option>
                <option value="108">Kazakhstan</option>
                <option value="109">Kiribati</option>
                <option value="110">Korea North</option>
                <option value="111">Korea South</option>
                <option value="112">Kuwait</option>
                <option value="113">Kyrgyzstan</option>
                <option value="114">Lao People&#39;s Democratic Republic</option>
                <option value="115">Latvia</option>
                <option value="116">Lebanon</option>
                <option value="117">Lesotho</option>
                <option value="118">Liberia</option>
                <option value="119">Libyan Arab Jamahiriya</option>
                <option value="120">Liechtenstein</option>
                <option value="121">Lithuania</option>
                <option value="122">Luxembourg</option>
                <option value="123">Macau</option>
                <option value="124">Macedonia</option>
                <option value="125">Madagascar</option>
                <option value="126">Malawi</option>
                <option value="127">Malaysia</option>
                <option value="128">Maldives</option>
                <option value="129">Mali</option>
                <option value="130">Malta</option>
                <option value="131">Marshall Islands</option>
                <option value="132">Martinique</option>
                <option value="133">Mauritania</option>
                <option value="134">Mauritius</option>
                <option value="135">Mayotte</option>
                <option value="136">Mexico</option>
                <option value="137">Micronesia</option>
                <option value="138">Moldova</option>
                <option value="139">Monaco</option>
                <option value="140">Mongolia</option>
                <option value="141">Montenegro</option>
                <option value="142">Montserrat</option>
                <option value="143">Morocco</option>
                <option value="144">Mozambique</option>
                <option value="145">Myanmar</option>
                <option value="146">Namibia</option>
                <option value="147">Nauru</option>
                <option value="148">Nepal</option>
                <option value="149">Netherlands</option>
                <option value="150">Netherlands Antilles</option>
                <option value="151">New Caledonia</option>
                <option value="152">New Zealand</option>
                <option value="153">Nicaragua</option>
                <option value="154">Niger</option>
                <option value="155">Nigeria</option>
                <option value="156">Nigeria KE</option>
                <option value="157">Niue</option>
                <option value="158">Norfolk Island</option>
                <option value="159">Northern Mariana Islands</option>
                <option value="160">Norway</option>
                <option value="161">Oman</option>
                <option value="162">Pakistan</option>
                <option value="163">Palau</option>
                <option value="164">Palestinian Territory</option>
                <option value="165">Panama</option>
                <option value="166">Papua New Guniea</option>
                <option value="167">Paraguy</option>
                <option value="168">Peru</option>
                <option value="169">Philippines</option>
                <option value="170">Poland</option>
                <option value="171">Portugal</option>
                <option value="172">Puerto Rico</option>
                <option value="173">Qatar</option>
                <option value="174">Reunion</option>
                <option value="175">Romania</option>
                <option value="176">Russian Federation</option>
                <option value="177">Rwanda</option>
                <option value="178">Saint Helena</option>
                <option value="179">Samoa</option>
                <option value="180">San Marino</option>
                <option value="181">Sao Tome and Principe</option>
                <option value="182">Saudi Arabia</option>
                <option value="183">Senegal</option>
                <option value="184">Serbia</option>
                <option value="185">Seychelles</option>
                <option value="186">Sierra Leone</option>
                <option value="187">Singapore</option>
                <option value="188">Slovakia</option>
                <option value="189">Slovenia</option>
                <option value="190">Solomon Islands</option>
                <option value="191">Somalia</option>
                <option value="192">South Africa</option>
                <option value="193">South Georgia and the South Sandwich Islands</option>
                <option value="194">Spain</option>
                <option value="195">Sri Lanka</option>
                <option value="196">St Kitts</option>
                <option value="197">St Lucia</option>
                <option value="198">St Vincent</option>
                <option value="199">Sudan</option>
                <option value="200">Suriname</option>
                <option value="201">Swaziland</option>
                <option value="202">Sweden</option>
                <option value="203">Switzerland</option>
                <option value="204">Syria</option>
                <option value="205">Taiwan</option>
                <option value="206">Tajikistan</option>
                <option value="207">Tanzania</option>
                <option value="208">Thailand</option>
                <option value="209">Togo</option>
                <option value="210">Tokelau</option>
                <option value="211">Tonga</option>
                <option value="212">Trinidad and Tobago</option>
                <option value="213">Tunisia</option>
                <option value="214">Turkey</option>
                <option value="215">Turkmenistan</option>
                <option value="216">Turks and Caicos</option>
                <option value="217">Tuvalu</option>
                <option value="218">Uganda</option>
                <option value="219">Ukraine</option>
                <option value="220">United Arab Emirates</option>
                <option value="221">United Kingdom</option>
                <option value="222">United States Minor Outlying Islands</option>
                <option value="223">Uruguay</option>
                <option value="224">USA</option>
                <option value="225">Uzbekistan</option>
                <option value="226">Vanuatu</option>
                <option value="227">Vatican City State</option>
                <option value="228">Venezuela</option>
                <option value="229">Vietnam</option>
                <option value="230">Virgin Islands (UK)</option>
                <option value="231">Virgin Islands (US)</option>
                <option value="232">Yemen</option>
                <option value="233">Yugoslavia</option>
                <option value="234">Zambia</option>
                <option value="235">Zimbabwae</option>
            </select>
        </div>
        <div class="clear">
        </div>
        <div class="editor-label">
            <label for="Gender">
                Sesso</label></div>
        <div class="editor-field">
            <input class="text-box single-line" id="Gender" name="Gender" type="text" value="" />
        </div>
        <div class="clear">
        </div>
        <div class="editor-label">
            <label for="Naked">
                Nudo</label></div>
        <div class="editor-field">
            <select class="list-box tri-state" id="Naked" name="Naked">
                <option selected="selected" value="">Not Set</option>
                <option value="true">True</option>
                <option value="false">False</option>
            </select>
        </div>
        <div class="clear">
        </div>
        <p>
            <input type="submit" value="Cerca..." /></p>
        </form>
    </div>
    <div id="searchResults" style="display: none">
        <h2>
            Risultati ricerca</h2>
        <table class="grid">
            <tr class="th">
                <th>
                    NickName
                </th>
                <th>
                    FirstName
                </th>
                <th>
                    LastName
                </th>
                <th>
                    Gender
                </th>
                <th>
                    BirthDate
                </th>
                <th>
                    Country
                </th>
            </tr>
        </table>
        <div class="pager">
            <ul>
                <li>1 </li>
            </ul>
        </div>
        <p>
            <a href="javascript:newSearch();">Nuova ricerca...</a></p>
    </div>
</asp:Content>
